import request from '@/utils/request'
import upload from '@/utils/upload'

// 查询用户信息详细
export function getBlogUser() {
  return request({
    url: '/blog/blogUser/getInfo',
    method: 'get'
  })
}

// 修改用户信息
export function updateBlogUser(data) {
  return request({
    url: '/blog/blogUser',
    method: 'put',
    data: data
  })
}


// 用户密码重置
export function resetUserPwd(userId, password) {
  const data = {
    userId,
    password
  }
  return request({
    url: '/blog/blogUser/resetPwd',
    method: 'put',
    data: data
  })
}
// 用户密码修改
export function updateUserPwd(oldPassword, newPassword) {
  const data = {
    oldPassword,
    newPassword
  }
  return request({
    url: '/blog/blogUser/updatePwd',
    method: 'put',
    params: data
  })
}
// 用户头像上传
export function uploadAvatar(data) {
  return upload({
    url: '/blog/blogUser/avatar',
    name: data.name,
    filePath: data.filePath
  })
}